import os

from Common.reader import Reader
from main import CONFIG_INI


class LoadCase(Reader):
    def __init__(self):
        self.project_name = self.read_ini(CONFIG_INI)['project']['project_name']
        self.test_case = self.read_ini(CONFIG_INI)['project']['test_case']
        self.project_path = os.path.dirname(os.path.dirname(__file__))




    def get_case(self):
        case_dict = dict()
        case_dir_path = os.path.join(self.project_path,'Testcase',self.project_name,'testcase')
        for case in self.test_case:
            case_path = os.path.join(case_dir_path,case)
            case_dict.update({case.split('.')[0]:self.read_excel(case_path)})
        return case_dict










if __name__ == '__main__':
    load_case = LoadCase('pqpc', ['sys_user_login.xlsx','project_saveProject.xlsx'])
    print(load_case.get_case())
    # print(os.path.dirname(__file__))
    # print(os.path.dirname(os.path.dirname(__file__)))
    # sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'fled'))